package me.magicall.db.sql.delete;

import me.magicall.db.sql.SqlElementTemplate;
import me.magicall.db.sql.from.From;
import me.magicall.db.sql.select.OrderBy;
import me.magicall.db.sql.where.Where;

public class Delete extends SqlElementTemplate {

	private From from;
	private Where where;
	private OrderBy orderBy;

	@Override
	public StringBuilder appendTo(final StringBuilder sb) {
		sb.append(" delete ");
		from.appendTo(sb);
		if (where != null) {
			where.appendTo(sb);
		}
		if (orderBy != null) {
			orderBy.appendTo(sb);
		}
		return sb;
	}

	public From getFrom() {
		return from;
	}

	public void setFrom(final From from) {
		this.from = from;
	}

	public Where getWhere() {
		return where;
	}

	public void setWhere(final Where where) {
		this.where = where;
	}

	public OrderBy getOrderBy() {
		return orderBy;
	}

	public void setOrderBy(final OrderBy orderBy) {
		this.orderBy = orderBy;
	}

}
